package plus.chendd.jdk8;

import org.junit.Test;

import java.util.Optional;

public class OptionalDemo {
  
  @Test
  public void startTest001() {
    System.out.println(Optional.ofNullable(null).isPresent());
    System.out.println(Optional.ofNullable("lihh").isPresent());
    
    System.out.println(Optional.ofNullable(null).orElse("chendd"));
    System.out.println(Optional.ofNullable("lll").orElse("chendd1"));
    
    Optional.of("zhangsan").ifPresent(System.out::println);
  }
}
